Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests, Fix minor bugs, Apply refactorings #1491 #1571

Merged
merged 3 commits into from
Dec 9, 2020

Conversation

ce-bo
Copy link
Collaborator

@ce-bo ce-bo commented Dec 9, 2020

Small refactorings and unit tests have been added

Please read the CONTRIBUTING.md before opening a PR.

Issue: #1491

Description

  • Fix calculation of map resolution scale factor - calculate on the basis of selected maps only (skip not selected maps)
  • Move some functions to the right place
  • Add unit tests for the calculation of the map resolution scale factor on the basis of the map size

const oneMB = 1024 * 1024
const totalFilesSizeKB = getSelectedFilesSize(files)

switch (true) {
Copy link
Contributor

@shaman-apprentice shaman-apprentice Dec 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Didn't know switch(true) is a thing. I would further refactor it to

if (totalFilesSizeKB >= 7 * oneMB) return MAP_RESOLUTION_SCALE.BIG_MAP
if (totalFilesSizeKB >= 2 * oneMB) return MAP_RESOLUTION_SCALE.MEDIUM_MAP
return MAP_RESOLUTION_SCALE.SMALL_MAP

@ce-bo ce-bo merged commit 75c6af9 into main Dec 9, 2020
@ce-bo ce-bo deleted the feature/1491/refactoring branch December 9, 2020 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants